{require_min_otp_vsn, "R19"}.

{erl_opts, [
    debug_info,
    {parse_transform, lager_transform}
]}.

{dialyzer, [
    %% {warnings, [error_handling, unknown, unmatched_returns]},
    {warnings, [error_handling, unknown]},
    {get_warnings, true}
]}.

{deps, [
    {lorawan_server_api, {git, "https://github.com/gotthardp/lorawan-server-api.git", {tag, "v0.4.11"}}},
    {lager, {git, "https://github.com/erlang-lager/lager.git", {tag, "3.5.1"}}},
    {syn, {git, "https://github.com/ostinelli/syn.git", {tag, "1.6.1"}}},
    {worker_pool, {git, "https://github.com/inaka/worker_pool.git", {tag, "3.1.0"}}},
    {jsx, {git, "https://github.com/talentdeficit/jsx.git", {tag, "2.8.2"}}},
    {cowlib, {git, "https://github.com/ninenines/cowlib", {tag, "2.0.0"}}},
    {cowboy, {git, "https://github.com/ninenines/cowboy", {tag, "2.0.0"}}},
    {gun, {git, "https://github.com/ninenines/gun.git", {tag, "1.0.0-pre.4"}}},
    {iso8601, {git, "https://github.com/erlsci/iso8601.git", {tag, "1.2.3"}}},
    {emqttc, {git, "https://github.com/emqtt/emqttc.git", {ref, "d4cbc38808fec0bda30be245268e876283c0e49f"}}}
]}.

{post_hooks, [
    {compile, "npm install --save"},
    {compile, "cp node_modules/jquery/dist/jquery.min.js priv/admin"},
    {compile, "cp node_modules/ng-admin/build/ng-admin.min.js priv/admin"},
    {compile, "cp node_modules/ng-admin/build/ng-admin.min.css priv/admin"},
    {compile, "cp node_modules/angular-simple-logger/dist/angular-simple-logger.min.js priv/admin"},
    {compile, "cp node_modules/angular-google-maps/dist/angular-google-maps.min.js priv/admin"},
    {compile, "cp node_modules/angular-google-chart/ng-google-chart.min.js priv/admin"},
    {compile, "cp node_modules/vis/dist/vis.min.js priv/admin"},
    {compile, "cp node_modules/vis/dist/vis.min.css priv/admin"},
    {compile, "cp -r node_modules/vis/dist/img priv/admin"},
    {compile, "cp node_modules/angular-visjs/angular-vis.js priv/admin"},
    {compile, "cp node_modules/angular-bootstrap-colorpicker/js/bootstrap-colorpicker-module.min.js priv/admin"},
    {compile, "cp node_modules/angular-bootstrap-colorpicker/css/colorpicker.min.css priv/admin"}
]}.

{artifacts, [
    "priv/admin/jquery.min.js",
    "priv/admin/ng-admin.min.js",
    "priv/admin/ng-admin.min.css",
    "priv/admin/angular-simple-logger.min.js",
    "priv/admin/angular-google-maps.min.js",
    "priv/admin/ng-google-chart.min.js",
    "priv/admin/vis.min.js",
    "priv/admin/vis.min.css",
    "priv/admin/angular-vis.js",
    "priv/admin/bootstrap-colorpicker-module.min.js",
    "priv/admin/colorpicker.min.css"
]}.

{relx, [
    {release, {'lorawan-server', "0.4.12"},
        [lorawan_server]},
    {sys_config, "lorawan_server.config"},
    {dev_mode, false},
    {include_src, false},
    {include_erts, false},
    {system_libs, false},
    {generate_start_script, false},
    {overlay, [
        {copy, "scripts/dbexport", "bin/dbexport"},
        {copy, "scripts/dbimport", "bin/dbimport"},
        {template, "scripts/lorawan-server", "bin/lorawan-server"},
        {copy, "scripts/lorawanctl", "bin/lorawanctl"},
        {template, "scripts/lorawan-server.bat", "bin/lorawan-server.bat"},
        {template, "scripts/lorawan-service.bat", "bin/lorawan-service.bat"},
        {copy, "scripts/lorawan-server.service", "bin/lorawan-server.service"}
    ]}
]}.
